package com.nt.train.config;

import com.nt.train.config.properties.AlipayPropertie3;
import com.nt.train.config.properties.JwtUtil2;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * @author hlf
 * @version 1.0
 * @date 2022/7/28 11:30
 */
// 用配置类去注册：属性配置类 实现方式1
//@EnableConfigurationProperties(AlipayPropertie2.class)
@SpringBootConfiguration
public class AlipayConfiguration {

//   实现方式2
//  @Bean
//    public AlipayPropertie2 alipayProperties2(){
//        return  new AlipayPropertie2();
//    }

    @Bean
    @ConfigurationProperties(prefix = "ksd.alipay")
    public AlipayPropertie3 alipayProperties3() {
        return new AlipayPropertie3();
    }

    @Bean
    @ConditionalOnProperty( prefix = "jwt" ,name="enable",havingValue = "true")
    public JwtUtil2 jwtUtil2(){
        return new JwtUtil2();
    }
}


